﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace WilkeService
{
    public class Cls_ServiceConroller
    {
        Cls_Group group;
        Cls_MessageCollection msgColl;
        List<Cls_Group> listGroup;
        string supervisorPassword;

        public Cls_ServiceConroller()
        {
            listGroup = new List<Cls_Group>();
        }

        public string ReadMessageOnClient(string message, string groupName)
        {
            foreach (var gmessage in msgColl.ListMsg)
            {
                if (gmessage.Msg == message && gmessage.GroupName == groupName)
                {
                    return message;
                }
            }

            return "";
        }

        public bool SetupNewGroup(string groupName)
        {
            bool created = false;

            try
            {
                group = new Cls_Group(groupName, new List<Cls_Program>());
                listGroup.Add(group);
                created = true;

            }

            catch (Exception ex)
            {
                throw ex;
            }

            return created;
        }

        #region Properties
        public string SupervisorPassword
        {
            get { return supervisorPassword; }
            set { supervisorPassword = value; }
        }

        public List<Cls_Group> ListGroup
        {
            get { return listGroup; }
            set { listGroup = value; }
        }
        #endregion
    }
}